<template>
  <div class="login">
    <div class="content" id="content">
      <el-form
        :model="loginForm"
        status-icon
        ref="loginForm"
        label-width="120px"
        class="demo-loginForm"
      >
        <el-form-item label="登录账号：" prop="username">
          <el-input
            v-model="loginForm.username"
            autocomplete="off"
            placeholder="请输入账号"
          >
            <i
              slot="prefix"
              class="el-input__icon el-icon-user"
              style="font-size: 18px"
            ></i>
          </el-input>
        </el-form-item>
        <el-form-item label="登录密码：" prop="password">
          <el-input
            type="password"
            v-model="loginForm.password"
            autocomplete="off"
            placeholder="请输入密码"
          >
            <i
              slot="prefix"
              class="el-input__icon el-icon-lock"
              style="font-size: 18px"
            ></i>
          </el-input>
        </el-form-item>

        <el-form-item>
          <el-button
            class="login-button"
            type="primary"
            size="medium"
            @click="login('loginForm')"
            >登录</el-button
          >
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      loginForm: {
        username: '',
        password: ''
      }
    }
  },
  methods: {
    login () {
      if (!this.loginForm.username) {
        this.$message({
          message: '请输入登录账户',
          type: 'warning'
        })
        return false
      }
      if (!this.loginForm.password) {
        this.$message({
          message: '请输入登录密码',
          type: 'warning'
        })
        return false
      }
      // 这里去调登录接口

      //  this.$router.push('/layout')
      this.$router.push({
        name: 'layout',
        params: { url: 'http://node18:7080/' }
      })
    }
  },
  activated () {}
}
</script>
<style  scoped>
.login {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  background-color: #f2f2f2;
}
.content {
  width: 600px;
  padding: 30px 60px;
  background-color: #fff;
  box-shadow: 0 0 0.177083rem 0 rgba(0, 33, 104, 0.08);
  border-radius: 20px;
}
</style>
